﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>

<%@page import="nc.vo.sm.UserVO"%>
<%@page import="nc.bs.ebvp.login.Constant"%>
<%@page import="nc.bs.ebvp.ctrept.form.CtReptMdHeadForm"%>
<%@page import="nc.bs.ebvp.ctrept.form.CtReptMdBodyProdForm"%>
<%@page import="nc.bs.ebvp.ctrept.form.CtReptMdWholeForm"%>
<%@page import="nc.bs.ebvppub.tools.DateTools"%>
<%@page import="nc.bs.ebvp.sourcingcoll.Constants"%>
<%@page import="nc.bs.ebvppub.ebvpservicefactory.LoadConfigProperty"%>
<%
	String basePath = request.getContextPath();

	String strParaEc021 = (String)request.getSession().getAttribute("EC021");
	UserVO userVo = (UserVO)request.getSession().getAttribute(Constant.USER_INFO);
	boolean isClientCa = false;
	//供应商客户端是否支持CA
	if("Y".equalsIgnoreCase(strParaEc021) || (null != userVo.getIsca() && userVo.getIsca().booleanValue())){
		isClientCa = true;
	}
	//CA厂商名称
	String strCaFactory = (String)request.getSession().getAttribute(LoadConfigProperty.EBVP_CA_FACTORY);
%>

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<%if(isClientCa){%>
		<%if(Constants.CA_FACTORY_ITRUS.equals(strCaFactory)){%>
		<script type="text/javascript" src="js/itrusforNC.js"></script>
		<script type="text/javascript" src="js/pta.js"></script>
		<%} else if(Constants.CA_FACTORY_INFOSEC.equals(strCaFactory)){%>
		<script type="text/javascript" src="js/Infosec4NC.js"></script>
		<%} else if(Constants.CA_FACTORY_DEAN.equals(strCaFactory)){%>
		<script type="text/javascript" src="js/DatechJs.js"></script>
		<%} %>
		<%}%>
		<script language="javascript" type="text/javascript"
			src="<%=basePath%>/js/validatorTool.js"></script>
		<script language="javascript" type="text/javascript"
			src="<%=basePath%>/js/utilTool.js"></script>
		<script src="<%=basePath%>/js/jquery-1.4.4.js" type="text/javascript"></script>
		<script type="text/javascript" src="<%=basePath%>/js/jquery-1.4.4.js"></script>
		<script type="text/javascript" src="<%=basePath%>/js/dialog.js"></script>
		<script type="text/javascript" src="<%=basePath%>/js/common.js"></script>
		<script type="text/javascript" src="<%=basePath%>/js/caltimer.js"></script>
		<script type="text/javascript" src="<%=basePath%>/js/jquery.form.js"></script>

		<!--日历控件-->
		<script language="javascript" type="text/javascript"
			src="<%=basePath%>/newcalendar/calendar.js"></script>
		<script language="javascript" type="text/javascript"
			src="<%=basePath%>/newcalendar/calendar-zh.js"></script>
		<script language="javascript" type="text/javascript"
			src="<%=basePath%>/newcalendar/calendar-setup.js"></script>

		<script language=JavaScript>
		//提交到后台审批流
		function submitForm(){
			
			var ErrMsg = notNull();
			if(trim(ErrMsg)!=""){
				alert(ErrMsg);
				return;
			}
		
			if(!checkDate()){
				alert("计划失效日期不允许早于计划生效日期!");
				return;
			}
			var bResult = true;
			<%if(isClientCa){%>
				bResult = doSignData();
			<%}%>
			if(bResult){
				document.modifyForm.action = "<%=basePath%>/contractprice/edit/commit";
				document.modifyForm.submit();
			}
		}
		
		//保存到后台
		function saveForm(){
		
			var ErrMsg = notNull();
			if(trim(ErrMsg)!=""){
				alert(ErrMsg);
				return;
			}
			
			if(!checkDate()){
				alert("计划失效日期不允许早于计划生效日期!");
				return;
			}
			var bResult = true;
			<%if(isClientCa){%>
				bResult = doSignData();
			<%}%>
			if(bResult){
				document.modifyForm.action = "<%=basePath%>/contractprice/edit/update";
				document.modifyForm.submit();
			}
		}	
		
		//对表体行的报价数据进行签名，将签名结果赋给表头的signature字段
		function doSignData(){
			var txl_prices = document.getElementsByName("taxless_price");   //无税单价
			var tx_prices = document.getElementsByName("tax_price");        //含税单价
			var discount = document.getElementsByName("discount");          //折扣率
			var rate = document.getElementsByName("rate");                  //税率
			var srcData = "";                                               //组装后的data
			var strSn = getSN("${USER_CODE}");
			if(strSn == null || strSn == ""){
				alert("请插入Key后再进行操作！");
				return false;
			}
			document.getElementById("casn").value = strSn;
			for(var i=0; i<txl_prices.length; i++){
				srcData += txl_prices[i].value +"|" + tx_prices[i].value + "|" 
				        + discount[i].value + "|" + rate[i].value + "|";
			}
			document.getElementById("signature").value = signmessage(srcData,  "${USER_CODE}");
			return true;
		}		
		
		//批量修改无税单价
		function mdTFPriceBatch(){
			var url = "url:post?<%=basePath%>/contractprice/addnew/editTFPriceBatch";
			var title = "批量修改无税单价";
			dialog(title, url,"500", "auto", "", "");
		}
		//批量修改含税单价
		function mdTPriceBatch(){
			var title = "批量修改含税单价";
			var url = "url:post?<%=basePath%>/contractprice/addnew/editTaxPriceBatch";
			dialog(title, url,"500", "auto", "", "");
		}
		//批量修改折扣率
		function mdDiscount(){
			var title = "批量修改折扣率";
			var url = "url:post?<%=basePath%>/contractprice/addnew/editDiscountBatch";
			dialog(title, url,"500", "auto", "", "");
		}
		//批量修改税率
		function mdTaxRate(){
			var title = "批量修改税率";
			var url = "url:post?<%=basePath%>/contractprice/addnew/editRateBatch";
			dialog(title, url,"500", "auto", "", "");
		}	
		
		function checkDate(){
			//计划失效日期应晚于计划生效日期
			//js格式的日期
			var vDate = document.getElementById("supposeValidDate").value.replace("-", "/");
			var invDate = document.getElementById("supposeInvalidDate").value.replace("-", "/");
			var date1 = new Date(Date.parse(vDate));
			var date2 = new Date(Date.parse(invDate));
			if(date1 > date2){
				return false;
			}else{
				return true;
			}			
		}
		
		function notNull(){
			var mdAppName = document.getElementById("mdAppName").value;
			var ctRepoNo = document.getElementById("ctRepoNo").value;
			var ctRepoName = document.getElementById("ctRepoName").value;
			var supposeValidDate = document.getElementById("supposeValidDate").value;
			var supposeInvalidDate = document.getElementById("supposeInvalidDate").value;
			var ErrMsg = "";
			
			if(mdAppName == null ||trim(mdAppName)==""){
				ErrMsg += "变更申请名称不允许为空!";
			}
			if(ctRepoNo == null || trim(ctRepoNo)==""){
				ErrMsg += "\n合同协议报价编号不允许为空!";
			}
			if(ctRepoName == null || trim(ctRepoName)==""){
				ErrMsg += "\n合同协议报价名称不允许为空!";
			}
			if(supposeValidDate == null || trim(supposeValidDate)==""){
				ErrMsg += "\n计划生效日期不允许为空!";
			}
			if(supposeInvalidDate == null || trim(supposeInvalidDate)==""){
				ErrMsg += "\n计划失效日期不允许为空!";
			}
			return ErrMsg;
		}		
			
		function trim(strToTrim) { 
	        result=strToTrim 
	        for (_i=0; _i<strToTrim.length; _i++) { 
	                if (strToTrim.charAt(_i)==" ") result=strToTrim.substr(_i+1) 
	                else _i=strToTrim.length 
	        } 
	        strToTrim=result 
	        for (_i=strToTrim.length-1; _i>=0; _i--) { 
	                if (strToTrim.charAt(_i)==" ") result=strToTrim.substr(0,_i) 
	                else _i=0 
	        } 
       		return result 
		} 
		
		function doCalPrice(changeKey,index){
				//计算行号
				var editRow = 0;
				editRow = index - 1;
				
				//物料主健
				var prodPks = document.getElementsByName("pk_prod");
				if(prodPks.length > editRow){
					document.calpriceform.pk_prod_cal.value = prodPks[editRow].value;
				}
				//报价单位
				var prodUnitPks = document.getElementsByName("pk_unit");
				if(prodUnitPks.length > editRow){
					document.calpriceform.pk_unit_cal.value = prodUnitPks[editRow].value;
				}
				//主单位
				var mainUnitPks = document.getElementsByName("main_unit");
				if(mainUnitPks.length > editRow){
					document.calpriceform.pk_primary_unit_cal.value = mainUnitPks[editRow].value;
				}
				//币种
				document.calpriceform.pk_currency_cal.value = document.getElementById("pk_cny").value;
				//数量
				var amounts = document.getElementsByName("number");  
				document.calpriceform.amount_cal.value = amounts[editRow].value;
				//无税单价
				var noTaxPrices = document.getElementsByName("taxless_price");
				document.calpriceform.no_tax_price_cal.value = noTaxPrices[editRow].value;
				//含税单价
				var hasTaxPrices = document.getElementsByName("tax_price");
				document.calpriceform.has_tax_price_cal.value = hasTaxPrices[editRow].value;
				//无税净价
				var noTaxNetPrices = document.getElementsByName("disct_taxless_price");
				document.calpriceform.no_tax_net_price_cal.value=noTaxNetPrices[editRow].value;
				//含税净价
				var hasTaxNetPrices = document.getElementsByName("disct_tax_price");
				document.calpriceform.has_tax_net_price_cal.value=hasTaxNetPrices[editRow].value;
				//税率
				var taxRates = document.getElementsByName("rate");
				if(taxRates[editRow].value == "" || taxRates[editRow].value == null){
					taxRates[editRow].value = "0.00";
				}
				document.calpriceform.tax_rate_cal.value = taxRates[editRow].value;
				//折扣率
				var discountRates = document.getElementsByName("discount");
				if(discountRates[editRow].value == "" || discountRates[editRow].value == null){
					return;
				}
				document.calpriceform.discount_rate_cal.value = discountRates[editRow].value;
				//换算率
				var conversion = document.getElementsByName("conversion");
				document.calpriceform.conversion_rate_cal.value = conversion[editRow].value;
				//主数量
				var main_amount = document.getElementsByName("main_amount");
				document.calpriceform.primary_amount_cal.value = main_amount[editRow].value;
				
				//主无税净价
				var mainTfPrices = document.getElementsByName("main_tf_price");
				document.calpriceform.primary_notax_net_price_cal.value = mainTfPrices[editRow].value;
				//主含税单价
				var mainTaxPrices = document.getElementsByName("main_tax_price");
				document.calpriceform.primary_hastax_net_price_cal.value = mainTaxPrices[editRow].value;
				
				//触发计算的字段为: changeKey
				document.calpriceform.property_cal.value= changeKey;
				//设置参数:无税优先，其他参数不设置，用默认值
				document.calpriceform.isTaxPrior.value="false"; 
				//行号
				document.calpriceform.row_no.value = index - 1;
				
				//提交表单
				var options2 = {
					beforeSubmit : showRequest2, 
					success : showResponse2
				};
				$('#calpriceform').ajaxSubmit(options2);
			}
		
			function showRequest2(formData, jqForm, options) {
			}
			
			function showResponse2(responseText, statusText, xhr, $form) {
				// 0:报价数量|1:税率|2:折扣率|3:含税单价|4:价税合计|5:含税净价|6:主含税净价|7:无税单价|8:无税金额|9:无税净价|10:主无税净价|11:税e|12:行号
				
				var responseArr = responseText.split("|");
				//无税单价
				var noTaxPrices = document.getElementsByName("taxless_price");
				noTaxPrices[responseArr[12]].value = responseArr[7];
				//含税单价
				var hasTaxPrices = document.getElementsByName("tax_price");
				hasTaxPrices[responseArr[12]].value = responseArr[3];
				//折扣率
				var discountRates = document.getElementsByName("discount");
				discountRates[responseArr[12]].value = responseArr[2];
				//折后无税单价
				var noTaxNetPrices = document.getElementsByName("disct_taxless_price");
				noTaxNetPrices[responseArr[12]].value = responseArr[9];
				//折后含税单价
                var hasTaxNetPrices = document.getElementsByName("disct_tax_price");
				hasTaxNetPrices[responseArr[12]].value = responseArr[5];
				//税率
				var taxRates = document.getElementsByName("rate");
				taxRates[responseArr[12]].value = responseArr[1];
				//换算率
				var conversion = document.getElementsByName("conversion");
				conversion[responseArr[12]].value = responseArr[13];
				//主数量
				var main_amount = document.getElementsByName("main_amount");
				main_amount[responseArr[12]].value = responseArr[14];
				//主无税净价
				var main_tf_price = document.getElementsByName("main_tf_price");
				main_tf_price[responseArr[12]].value = responseArr[10];
				//主含税净价
				var main_tax_price = document.getElementsByName("main_tax_price");
				main_tax_price[responseArr[12]].value = responseArr[6]; 
			}
	</script>
	</head>

	<body class="fullbody">
		<div class="context">
			<div class="position">
				<div class="tposi">
					当前位置:
					<a href="<%=request.getContextPath()%>/infopub/pubmain?menuid=1"
						class="linkstyle">首页</a>&nbsp;&gt;&gt;&nbsp;
					<a href="javascript:changeMenu(3,'');" class="linkstyle">我的订单\合同</a>
					&nbsp;&gt;&gt;&nbsp;
					<a
						href="<%=request.getContextPath()%>/contractprice/ctreptlist?menuid=35">合同协议报价维护</a>
					&nbsp;&gt;&gt;&nbsp;
					<span class="curposition">合同协议报价变更</span>
				</div>
				<div class="help">
                  	<a href="javascript:void(null);" onclick="doHelp('<%=request.getContextPath()%>/help/html/HTXYBJWH.html');" class="linkstyle">帮助</a>
              	</div>
			</div>
			<div class="margin8">
			</div>
			<div class="subpage_title">
				<div class="title_index">
					<img src="<%=basePath%>/images/common/dot03.gif" alt="" border="0" />
					&nbsp;合同协议报价变更
				</div>
				<div class="rollback">
					<a
						href="<%=request.getContextPath()%>/contractprice/ctreptlist?menuid=35">&lt;&lt;&nbsp;返回合同协议报价维护</a>
				</div>
			</div>
			<div class="margin10">
			</div>
			<div>
				<!-- 计算用的form -->
				<form id="calpriceform" name="calpriceform" method="post"
					action="<%=basePath%>/sourcing/biddingprojlist/calprice">
					<!-- 集团 -->
					<input type="hidden" id="pk_group_cal" name="pk_group_cal" value="" />
					<!-- 产品 -->
					<input type="hidden" id="pk_prod_cal" name="pk_prod_cal" value="" />
					<!-- 报价币种 -->
					<input type="hidden" id="pk_currency_cal" name="pk_currency_cal"
						value="" />
					<!-- 报价单位 -->
					<input type="hidden" id="pk_unit_cal" name="pk_unit_cal" value="" />
					<!-- 主单位 -->
					<input type="hidden" id="pk_primary_unit_cal"
						name="pk_primary_unit_cal" value="" />
					<!-- 报价数量 -->
					<input type="hidden" id="amount_cal" name="amount_cal" value="" />
					<!-- 主数量 -->
					<input type="hidden" id="primary_amount_cal"
						name="primary_amount_cal" value="" />
					<!-- 换算率 -->
					<input type="hidden" id="conversion_rate_cal"
						name="conversion_rate_cal" value="" />
					<!-- 扣税类别 -->
					<input type="hidden" id="tax_type_cal" name="tax_type_cal" value="" />
					<!-- 税率 -->
					<input type="hidden" id="tax_rate_cal" name="tax_rate_cal" value="" />
					<!-- 折扣率 -->
					<input type="hidden" id="discount_rate_cal"
						name="discount_rate_cal" value="" />
					<!-- 含税单价 -->
					<input type="hidden" id="has_tax_price_cal"
						name="has_tax_price_cal" value="" />
					<!-- 含税金额 -->
					<input type="hidden" id="has_tax_sum_cal" name="has_tax_sum_cal"
						value="" />
					<!-- 含税净价 -->
					<input type="hidden" id="has_tax_net_price_cal"
						name="has_tax_net_price_cal" value="" />
					<!-- 主含税净价 -->
					<input type="hidden" id="primary_hastax_net_price_cal"
						name="primary_hastax_net_price_cal" value="" />
					<!-- 无税单价 -->
					<input type="hidden" id="no_tax_price_cal" name="no_tax_price_cal"
						value="" />
					<!-- 无税金额 -->
					<input type="hidden" id="no_tax_sum_cal" name="no_tax_sum_cal"
						value="" />
					<!-- 无税净价 -->
					<input type="hidden" id="no_tax_net_price_cal"
						name="no_tax_net_price_cal" value="" />
					<!-- 主无税净价 -->
					<input type="hidden" id="primary_notax_net_price_cal"
						name="primary_notax_net_price_cal" value="" />
					<!-- 价税合计 -->
					<input type="hidden" id="price_tax_sum_cal"
						name="price_tax_sum_cal" value="" />
					<input type="hidden" id="tax_sum_cal" name="tax_sum_cal" value="" />
					<!-- 计算字段顺序 (这里拿数量去触发计算)-->
					<input type="hidden" id="property_cal" name="property_cal" value="" />
					<!-- 计算行 -->
					<input type="hidden" id="row_no" name="row_no" value="" />
					<!-- 参数字段 -->
					<input type="hidden" id="isTaxPrior" name="isTaxPrior" value="" />
				</form>
				<form action="" method="post" name="modifyForm">
						<!-- 隐藏域，合同主键 , 合同协议报价主键， 为处理来源单据与源头单据-->

						<input name="signature" id="signature" type="hidden" value="" />
						<input name="casn" id="casn" type="hidden" value="" />

						<!-- 合同协议报价变更主键 -->
						<input name="pk_mdApp" id="pk_mdApp" type="hidden"
							value="${MDHEAD_FORM.pk_mdApp}" />

						<!-- pk_org在下面  表头中定义 -->
						<input name="pk_group" id="pk_group" type="hidden"
							value="${MDHEAD_FORM.pk_group}" />

						<input name="ct_pk" id="ct_pk" type="hidden"
							value="${MDHEAD_FORM.ct_pk}" />
						<input name="ctRepoPk" id="ctRepoPk" type="hidden"
							value="${MDHEAD_FORM.ctRepoPk}" />

						<input name="originhpk" id="originhpk" type="hidden"
							value="${MDHEAD_FORM.originhpk}" />
						<input name="originbillno" id="originbillno" type="hidden"
							value="${MDHEAD_FORM.originbillno}" />
						<input name="originbilltype" id="originbilltype" type="hidden"
							value="${MDHEAD_FORM.originbilltype}" />
						<input name="origintranstype" id="origintranstype" type="hidden"
							value="${MDHEAD_FORM.origintranstype}" />

						<input name="srchpk" id="srchpk" type="hidden"
							value="${MDHEAD_FORM.ctRepoPk}" />
						<input name="srcbillno" id="srcbillno" type="hidden"
							value="${MDHEAD_FORM.ctRepoNo}" />
						<input name="srcbilltype" id="srcbilltype" type="hidden"
							value="${MDHEAD_FORM.srcbilltype}" />
						<input name="srctranstype" id="srctranstype" type="hidden"
							value="${MDHEAD_FORM.srctranstype}" />
						<input name="prod_size" type="hidden" id="prod_size"
							value="${MD_BODY_FORM_COUNT}" />

						<input name="ts" type="hidden" id="ts" value="${MDHEAD_FORM.ts}" />

						<div class="priceform">
							<div class="contract_price_form_title">
								<p align="center">
									${MDHEAD_FORM.ctRepoName}(编号:${MDHEAD_FORM.ctRepoNo} )
								</p>
							</div>
							<div class="margin10">
							</div>
							<div class="lineconner1">
								<div class="left1">
									<img src="<%=basePath%>/images/conner/a_01.png" alt="" />
								</div>
								<div class="right1">
									<img src="<%=basePath%>/images/conner/b_01.png" alt="" />
								</div>
								<div class="c_context">
									<table class="searchtable" cellpadding="0" cellspacing="0" border="0" >
										<tr class="inputrow">
											<td class="w_1">
												变更申请单号：
											</td>
											<td class="w_2">
												<input name="mdAppBillno" id="mdAppBillno" type="text"
													class="inputbox" value="${MDHEAD_FORM.mdAppBillno}"
													readonly />
												<span class="needfill">*</span>
											</td>
											<td class="w_1">
												变更申请名称：
											</td>
											<td class="w_2">
												<input name="mdAppName" id="mdAppName" type="text"
													class="inputbox" value="${MDHEAD_FORM.mdAppName}" />
												<span class="needfill">*</span>
											</td>
										</tr>

										<tr class="inputrow">
											<td class="w_1">
												变更申请部门：
											</td>
											<td class="w_2">
												<input name="mdAppDept" id="mdAppDept" type="text"
													class="inputbox" value="" readonly />
											</td>
											<td class="w_1">
												变更申请人：
											</td>
											<td class="w_2">
												<input name="mdAppPerson" id="mdAppPerson" type="text"
													class="inputbox" value="" readonly />
											</td>
										</tr>
										<tr class="inputrow">
											<td class="w_1">
												变更申请理由：
											</td>
											<td class="w_2">
												<input name="mdAppReason" id="mdAppReason" type="text"
													class="inputbox" value="${MDHEAD_FORM.mdAppReason}" />
											</td>
											<td class="w_1">
												合同协议报价编号：
											</td>
											<td class="w_2">
												<input name="ctRepoNo" id="ctRepoNo" type="text"
													class="inputbox" value="${MDHEAD_FORM.ctRepoNo}" readonly />
												<span class="needfill">*</span>
											</td>
										</tr>

										<tr class="inputrow">
											<td class="w_1">
												合同协议报价名称：
											</td>
											<td class="w_2">
												<input name="ctRepoName" id="ctRepoName" type="text"
													class="inputbox" value="${MDHEAD_FORM.ctRepoName}" readonly />
												<span class="needfill">*</span>
											</td>
											<td class="w_1">
												计划生效日期：
											</td>
											<td class="w_2">
												<!--<input name="supposeValidDate" type="text" class="inputbox" value="${MDHEAD_FORM.supposeValidDate}" /><span class="needfill">*</span>-->
												<input id="supposeValidDate" name="supposeValidDate"
													type="text" value="${MDHEAD_FORM.supposeValidDate}"
													onclick="return showCalendar('supposeValidDate', 'y-mm-dd');"
													readonly="readonly" class="searchdate" />
												<span class="needfill">*</span>
											</td>
										</tr>
										<tr class="inputrow">
											<td class="w_1">
												计划失效日期：
											</td>
											<td class="w_2">
												<!--
                                            <input name="supposeInvalidDate" type="text" class="inputbox" value="${MDHEAD_FORM.supposeInvalidDate}" /><span class="needfill">*</span>-->
												<input id="supposeInvalidDate" name="supposeInvalidDate"
													type="text" value="${MDHEAD_FORM.supposeInvalidDate}"
													onclick="return showCalendar('supposeInvalidDate', 'y-mm-dd');"
													readonly="readonly" class="searchdate" />
												<span class="needfill">*</span>
											</td>
											<td class="w_1">
												采购公司：
											</td>
											<td class="w_2">
												${MDHEAD_FORM.org_name}
												<input name="pk_org" id="pk_org" type="hidden" id="pk_org"
													value="${MDHEAD_FORM.pk_org}" />
												<input name="pk_supplier" type="hidden" id="pk_supplier"
													value="${MDHEAD_FORM.pk_supplier}" />
											</td>
										</tr>
										<!-- 以下字段是label，不是input -->
										<tr class="inputrow">
											<td class="w_1">
												币种：
											</td>
											<td class="w_2">
												${MDHEAD_FORM.currency}
												<input name="pk_cny" type="hidden" id="pk_cny"
													value="${MDHEAD_FORM.pk_cny}" />
											</td>
											<td class="w_1">
												确认状态：
											</td>
											<td class="w_2">
												${MDHEAD_FORM.cfmstatus_name}
												<input name="pk_operator" type="hidden" id="pk_operator"
													value="${MDHEAD_FORM.pk_operator}" />
												<input name="operatetime" type="hidden" id="operatetime"
													value="${MDHEAD_FORM.operatetime}" />
												<input name="pk_lastmdperson" type="hidden"
													id="pk_lastmdperson" value="${MDHEAD_FORM.pk_lastmdperson}" />
												<input name="lastmdtime" type="hidden" id="lastmdtime"
													value="${MDHEAD_FORM.lastmdtime}" />
											</td>
										</tr>
									</table>
								</div>
								<!--div c_context -->
								<div class="left2">
									<img src="<%=basePath%>/images/conner/c_01.png" alt="" />
								</div>
								<div class="right2">
									<img src="<%=basePath%>/images/conner/d_01.png" alt="" />
								</div>
							</div>
							<!--div  lineconner1 -->
						</div>
						<!--div priceform -->

						<div class="margin10">
						</div>
						<div class="pricelist">
							<div>
								<table border="0" cellpadding="0" cellspacing="0" width="100%">
									<tr>
										<td align="left" class="contract_price_form_pricelist_title">
											<b>产品信息</b>
										</td>
										<td align="right" class="contract_price_form_pricelist_batchmd">
											<b>批量修改:</b>
											<label class="linkstyle1" onclick="mdDiscount()"
												ondblclick="mdDiscount()">
											折扣率
											</label>
											&nbsp;
											<label class="linkstyle1" onclick="mdTaxRate()"
												ondblclick="mdTaxRate()">
											税率
											</label>
										</td>
									</tr>								
								</table>
							</div>
							<div class="margin10">
							</div> 
							<div class="contract_price">
								<div>
									<table cellpadding="0" cellspacing="0" class="tableCss" >
									<tr class="titleTr">
										<th width="313">
											产品
										</th>
										<th width="101">
											数量
										</th>
										<th width="190">
											价格
										</th>
										<th class="th1" width="196">
											金额
										</th>
									</tr>

									<%
										String i = "1";
									%>
									<c:if test="${MD_BODY_FORM_LIST != null}">
										<c:forEach items="${MD_BODY_FORM_LIST}" var="item">
											<%
												int x = Integer.parseInt(i);
														if (x % 2 == 1) {
											%>
										    	<tr align="left" class="contTr-old"  >
										    <%
										    	} else {
										    %>
												<tr align="left" class="contTr-even">
											<%
												}
											%>
										    	<td class="td1">
										    		<c:if test="${item.pk_prod!=null}">
										    			<span class="prodName">${item.pk_prod_name}</span><br/>
										    			<c:if test="${item.module!=null}">规格：${item.module}<br/></c:if>
										    			<c:if test="${item.type!=null}">型号：${item.type}<br/></c:if>
										    			<c:if test="${item.project_name!=null}"> 项目：${item.project_name}<br/></c:if>
										    			<c:if test="${item.producer_name!=null}">生产厂商：${item.producer_name}</c:if>
										    		</c:if>
										    		<c:if test="${item.pk_prod==null}">
										    			<span class="prodName">${item.prod_type_name}</span>
										    		</c:if>
										    	</td>
										    	<td class="td1">
										    		<font class="words-blue">${item.number}</font>${item.unit_name}
										    	</td>
										    	<td class="td1">
										    		含税单价：<font class="words-red-bold"><input name="tax_price" type="text" class="input-edit"
														id="tax_price" value="${item.tax_price}"
														onkeypress="javascript:keyPress(this);" 
														onchange="subReduNum(this,${PRICE_DIGIT});javascript:doCalPrice('has_tax_price', '<%=i%>');"/></font>
										    		<br/>
										    		无税单价：<font class="words-red-bold"><input name="taxless_price" type="text" class="input-edit"
														id="taxless_price" value="${item.taxless_price}"
														onkeypress="javascript:keyPress(this);" 
														onchange="subReduNum(this,${PRICE_DIGIT});javascript:doCalPrice('no_tax_price', '<%=i%>');"/></font>
													<br/>
													折扣率：	
														<font class="words-blue"><input name="discount" type="text" class="input-edit"
														id="discount" value="${item.discount}"
														onkeypress="javascript:keyPress(this);" onchange="subReduNum(this,2);javascript:doCalPrice('discount_rate', '<%=i%>');"/>%</font>
													<br/>
													净含税单价：<font class="words-red-bold"><input name="disct_tax_price" type="text" class="input-unEdit"
														id="disct_tax_price" value="${item.disct_tax_price}" /></font>
													
													<!-- 无税净价-隐藏 -->
													<input name="disct_taxless_price" type="hidden" 
														id="disct_taxless_price"
														value="${item.disct_taxless_price}" readonly/>
										    	</td>
										    	
										    	<td class="td1">
										    		税率：<font class="words-blue"><input name="rate" type="text" class="input-edit" id="rate"
														value="${item.rate}"
														onkeypress="javascript:keyPress(this);" onchange="subReduNum(this,2);javascript:doCalPrice('tax_rate', '<%=i%>');"/>%</font>
													<br/>
													价税合计：<font class="words-red-bold"><c:out value="${item.total_price_tax}" /></font> 
													 <!-- 隐藏字段 -->
												<input name="tax_code" id="tax_code" type="hidden"
													value="${item.tax_code}" />
												<input name="real_rate" id="real_rate" type="hidden"
													value="${item.real_rate}" />
												<input name="cost_price" id="cost_price" type="hidden"
													value="${item.cost_price}" />
												<input name="row_id" id="row_id" type="hidden"
													value="<%=i%>" />
												<input name="pk_ctrpt_alter_b" type="hidden"
													id="pk_ctrpt_alter_b" value="${item.pk_ctrpt_alter_b}" />
												<input name="pk_prod_type" type="hidden" id="pk_prod_type"
													value="${item.pk_prod_type}" />
												<input name="pk_prod" type="hidden" id="pk_prod"
													value="${item.pk_prod}" />
												<input name="module" type="hidden" id="module"
													value="${item.module}" />
												<input name="type" type="hidden" id="type"
													value="${item.type}" />
												<input name="project" type="hidden" id="project"
													value="${item.project}" />
												<input name="producer" type="hidden" id="producer"
													value="${item.producer}" />
												<input name="pk_unit" type="hidden" id="pk_unit"
													value="${item.pk_unit}" />
												<input name="number" type="hidden" id="number"
													value="${item.number}" />
												<input name="taxless_amount" type="hidden"
													id="taxless_amount" value="${item.taxless_amount}" />
												<input name="tax_amount" type="hidden" id="tax_amount"
													value="${item.tax_amount}" />
												<input name="total_price_tax" type="hidden"
													id="total_price_tax" value="${item.total_price_tax}" />
												<input name="conversion" type="hidden" id="conversion"
													value="${item.conversion}" />
												<input name="main_unit" type="hidden" id="main_unit"
													value="${item.main_unit}" />
												<input name="main_amount" type="hidden" id="main_amount"
													value="${item.main_amount}" />
												<input name="main_tf_price" type="hidden" id="main_tf_price"
													value="${item.main_tf_price}" />
												<input name="main_tax_price" type="hidden"
													id="main_tax_price" value="${item.main_tax_price}" />
												<input name="b_firstbilltype" type="hidden"
													id="b_firstbilltype" value="${item.firstbilltype}" />
												<input name="b_firstbillno" type="hidden" id="b_firstbillno"
													value="${item.firstbillno}" />
												<input name="b_firsthpk" type="hidden" id="b_firsthpk"
													value="${item.firsthpk}" />
												<input name="b_firstbpk" type="hidden" id="b_firstbpk"
													value="${item.firstbpk}" />
												<input name="b_firsttrantype" type="hidden"
													id="b_firsttrantype" value="${item.firsttrantype}" />
												<input name="b_srcbilltype" type="hidden" id="b_srcbilltype"
													value="${item.srcbilltype}" />
												<input name="b_srcbillno" type="hidden" id="b_srcbillno"
													value="${item.srcbillno}" />
												<input name="b_srchpk" type="hidden" id="b_srchpk"
													value="${item.srchpk}" />
												<input name="b_srcbpk" type="hidden" id="b_srcbpk"
													value="${item.srcbpk}" />
												<input name="b_srctrantype" type="hidden" id="b_srctrantype"
													value="${item.srctrantype}" />
										    	</td>
										   	</tr>
											<%
												x++;
												i = String.valueOf(x);
											%>
										</c:forEach>
									</c:if>
								</table>
								
								</div>
							</div>
							<div class="margin8">
							</div>
						</div>

					</form>
					<!-- modifyForm 结束 -->
					<div class="contract_price_form_buttonrow">
						<input type="button" class="buttonok" value="提交"
							onclick="submitForm()" />
						&nbsp;&nbsp;
						<input type="button" class="buttonok" value="保存"
							onclick="saveForm()" />
						&nbsp;&nbsp;
						<input type="button" class="buttoncan" value="取消"
							onclick="cancelForm()" />
					</div>
				</div>
				<div class="margin10">
				</div>
			</div>

	</body>

</html>
